package com.aabte.design2.creational.singleton;

/**
 * ThreadLocal单线程单例
 */
public class ThreadLocalInstance {

    private static final ThreadLocal<ThreadLocalInstance> THREAD_LOCAL_INSTANCE = new ThreadLocal<ThreadLocalInstance>() {
        @Override
        protected ThreadLocalInstance initialValue() {
            return new ThreadLocalInstance();
        }
    };

    private ThreadLocalInstance() {
    }

    public static ThreadLocalInstance getInstance() {
        return THREAD_LOCAL_INSTANCE.get();
    }

}
